/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.proyectos.model;

import java.math.BigDecimal;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Jose
 */
@Entity

@NamedQueries({
    @NamedQuery(name = "Hitos.findAll", query = "SELECT h FROM Hitos h WHERE h.ncarrera = :ncarrera "),
    @NamedQuery(name = "Hitos.findByNombre", query = "SELECT h FROM Hitos h WHERE upper(h.cnombre) = :cnombre and h.ncarrera = :ncarrera "),
    @NamedQuery(name = "Hitos.findByLike", query = "SELECT h FROM Hitos h WHERE upper(h.cnombre) like :cnombre and h.ncarrera = :ncarrera")}) 
public class Hitos {
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column
    private BigDecimal ncodigo;
 
    @Column
    private String cnombre;
  
    @Column
    private String cdescripcion;
   @ManyToOne
    @JoinColumn(name="ncarrera")
    private Carreras ncarrera;

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + Objects.hashCode(this.cnombre);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Hitos other = (Hitos) obj;
        if (!Objects.equals(this.cnombre, other.cnombre)) {
            return false;
        }
        return true;
    }

    public BigDecimal getNcodigo() {
        return ncodigo;
    }

    public void setNcodigo(BigDecimal ncodigo) {
        this.ncodigo = ncodigo;
    }

    public String getCnombre() {
        return cnombre;
    }

    public void setCnombre(String cnombre) {
        this.cnombre = cnombre;
    }

    public String getCdescripcion() {
        return cdescripcion;
    }

    public void setCdescripcion(String cdescripcion) {
        this.cdescripcion = cdescripcion;
    }

    public Carreras getNcarrera() {
        return ncarrera;
    }

    public void setNcarrera(Carreras ncarrera) {
        this.ncarrera = ncarrera;
    }

}
